<?php
/**
 * @version	$Id: view.html.php 21 2011-02-10 18:29:45Z gregdaynes@gmail.com $
 * @package	jEvolve.syncr
 * @copyright  Copyright (C) 2010 jEvolve, LLC. All rights reserved.
 * @license	GNU General Public License
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

// import application view
jimport('joomla.application.component.view');

class SyncrViewHolding extends JView
{
	public function display($tpl = null)
	{
		$db =& JFactory::getDBO();
		$app =& JFactory::getApplication();
		$params =& JComponentHelper::getParams('com_syncr');
		
		// list ordering
		$lists['order']		= $app->getUserStateFromRequest('com_syncr.filterOrder', 'filter_order', 'name', 'word');
		$lists['orderDirection'] = $app->getUserStateFromRequest('com_syncr.filterOrderDirection', 'filter_order_Dir', 'ASC', 'cmd');
		
		if (strtoupper($lists['orderDirection']) !== 'ASC') {
			$lists['orderDirection'] = 'DESC';
		}
				
		// data
		$rows =& $this->get('data');
				
		// pagination
		$pagination	=& $this->get('pagination');
		$rowcount	= count($rows);
		$pageOrd	= new JPagination($rowcount, 0, $rowcount);
		
		// assign references
		$this->assignRef('rows', $rows);
		$this->assignRef('pagination', $pagination);
		$this->assignRef('pageOrd', $pageOrd);
		$this->assignRef('lists', $lists);
		
		
		// set toolbar
		$this->_setToolBar();
		
		// call parent behavior with template
		parent::display($tpl);
	}
	
	private function _setToolBar() {
		JToolBarHelper::title(JText::_('SYNCR_HOLDING_PEN'), 'generic.png');
		JToolBarHelper::publishList( );
		JToolBarHelper::deleteList('ARE_YOU_SURE_YOU_WANT_TO_DELETE_THE_SELECTED_SITES');
		JToolBarHelper::preferences('com_syncr', 350);
	}
}